<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                xmlns:pe="http://primefaces.org/ui/extensions"
                xmlns:hr="http://java.sun.com/jsf/composite/autocomplete">

    <ui:define name="content">
        <h:form>
            <p:panel header="Form Working Shift Sheet">
                <h:panelGrid columns="2">

                    <p:panel header="Search Forms">
                        <h:panelGrid columns="2">
                            <h:panelGrid columns="2">
                                <h:outputLabel value="From Date"/>
                                <p:calendar value="#{staffAdditionalFormController.fromDate}"
                                            pattern="yyyy MM dd HH:mm:ss" >
                                </p:calendar>
                                <h:outputLabel value="To Date"/>
                                <p:calendar id="forDateS" value="#{staffAdditionalFormController.toDate}"
                                            pattern="yyyy MM dd HH:mm:ss" >
                                </p:calendar>
                                <h:outputLabel value="Institution : "/>
                                <hr:institution value="#{staffAdditionalFormController.reportKeyWord.institution}"/>
                                <h:outputLabel value="Department : "/>
                                <hr:department value="#{staffAdditionalFormController.reportKeyWord.department}"/>
                                <h:outputLabel value="Employee : "/>
                                <hr:completeStaff value="#{staffAdditionalFormController.reportKeyWord.staff}"/>
                                <h:outputLabel value="Staff Category : "/>
                                <hr:completeStaffCategory value="#{staffAdditionalFormController.reportKeyWord.staffCategory}"/>
                                <h:outputLabel value="Staff Designation : "/>
                                <hr:completeDesignation value="#{staffAdditionalFormController.reportKeyWord.designation}"/>
                                <h:outputLabel value="Staff Roster : "/>
                                <hr:completeRoster value="#{staffAdditionalFormController.reportKeyWord.roster}"/>
                                <h:outputLabel value="Time Type : "/>
                                <p:selectOneMenu   value="#{staffAdditionalFormController.reportKeyWord.times}">
                                    <f:selectItem itemLabel="Please Day Type "/>
                                    <f:selectItems  value="#{enumController.timeses}" ></f:selectItems>                    
                                </p:selectOneMenu> 



                            </h:panelGrid>
                            <h:panelGrid columns="2" rendered="false">
                                <h:outputLabel value="Day Type"/>
                                <p:selectManyCheckbox value="#{staffAdditionalFormController.reportKeyWord.dayTypes}" layout="grid" columns="1" >
                                    <f:selectItems value="#{enumController.dayTypes}" var="e" itemLabel="#{e}" itemValue="#{e}" ></f:selectItems>
                                </p:selectManyCheckbox>
                            </h:panelGrid>
                        </h:panelGrid>
                        <p:commandButton ajax="false" value="Search By Created Date" action="#{staffAdditionalFormController.searchFormByCreatedDate()}" />                           
                        <p:commandButton ajax="false" value="Search By Shift Date" action="#{staffAdditionalFormController.searchFormByShiftDate()}" />      
                        <p:commandButton ajax="false" value="Excel" styleClass="noPrintButton" onclick="onSubmitButton();" >
                            <pe:exporter type="xlsx" target="tb1" fileName="hr_form_staff_form_report"  />
                        </p:commandButton>
                        <p:commandButton value="Print" ajax="false" action="#" >
                            <p:printer target="gpBillPreview" ></p:printer>
                        </p:commandButton>

                        <p:panel id="gpBillPreview" styleClass="noBorder summeryBorder" >  

                            <p:dataTable  value="#{staffAdditionalFormController.hrForms}" 
                                          var="add" id="tb1" >
                                
                                <f:facet name="header">
                                    
                                    <h:outputLabel value="Additional Working Shift Sheet"/><br/>
                                    <h:outputLabel value="  From : "  />
                                    <h:outputLabel  value="#{staffAdditionalFormController.fromDate}" >
                                        <f:convertDateTime pattern="dd MM yy "/>
                                    </h:outputLabel>
                                    <h:outputLabel/>
                                    <h:outputLabel/>
                                    <h:outputLabel value="  To : "/> 
                                    <h:outputLabel  value="#{staffAdditionalFormController.toDate}">
                                        <f:convertDateTime pattern="dd MM yy "/>
                                    </h:outputLabel><br/>
                                    <h:panelGroup rendered="#{staffAdditionalFormController.reportKeyWord.institution ne null}" >
                                        <h:outputLabel value="#{staffAdditionalFormController.reportKeyWord.institution.name}" />
                                        <br/>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{staffAdditionalFormController.reportKeyWord.department ne null}" >
                                        <h:outputLabel value="Department : #{staffAdditionalFormController.reportKeyWord.department.name}"/>
                                        <br/>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{staffAdditionalFormController.reportKeyWord.staff ne null}" >
                                        <h:outputLabel value="Staff : #{staffAdditionalFormController.reportKeyWord.staff.person.name}"/>
                                        <br/>
                                    </h:panelGroup>
                                </f:facet>

                                <p:column headerText="Form Number" sortBy="#{add.code}">
                                    <f:facet name="header">
                                        <h:outputLabel value="Form Number"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.code}" ></p:outputLabel>
                                </p:column>

                                <p:column headerText="Code" sortBy="#{add.staff.codeInterger}">
                                    <f:facet name="header">
                                        <h:outputLabel value="Code"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.staff.codeInterger}" ></p:outputLabel>
                                </p:column>

                                <p:column headerText="Staff">
                                    <f:facet name="header">
                                        <h:outputLabel value="Staff"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.staff.person.nameWithTitle}" ></p:outputLabel>
                                </p:column>

                                <p:column headerText="Created At" sortBy="#{add.createdAt}">
                                    <f:facet name="header">
                                        <h:outputLabel value="Created At"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.createdAt}" >
                                        <f:convertDateTime pattern="yyyy MM dd HH:mm:ss" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column headerText="Class">
                                    <h:outputLabel value="#{add}"/>
                                </p:column>

                                <p:column headerText="Roster">
                                    <f:facet name="header">
                                        <h:outputLabel value="Roster"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.staffShift.roster.name}" ></p:outputLabel>
                                </p:column>

                                <p:column headerText="Shift Start">
                                    <f:facet name="header">
                                        <h:outputLabel value="Shift Start Time"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.staffShift.shiftStartTime}" >
                                        <f:convertDateTime pattern="yyyy MM dd HH:mm:ss" />
                                    </p:outputLabel>
                                </p:column>

                                <p:column headerText="Shift End">
                                    <f:facet name="header">
                                        <h:outputLabel value="Shift End Time"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.staffShift.shiftEndTime}" >
                                        <f:convertDateTime pattern="yyyy MM dd HH:mm:ss" />
                                    </p:outputLabel>
                                </p:column>


                                <p:column headerText="From">
                                    <f:facet name="header">
                                        <h:outputLabel value="Additional From "/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.fromTime}" >
                                        <f:convertDateTime pattern="yyyy MM dd HH:mm:ss" />
                                    </p:outputLabel>
                                </p:column>

                                <p:column headerText="To">
                                    <f:facet name="header">
                                        <h:outputLabel value="Additional Form To"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.toTime}" >
                                        <f:convertDateTime pattern="yyyy MM dd HH:mm:ss" />
                                    </p:outputLabel>
                                </p:column>


                                <p:column headerText="Time">
                                    <f:facet name="header">
                                        <h:outputLabel value="Time"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.times}" ></p:outputLabel>
                                </p:column>


                                <p:column headerText="Day Type">
                                    <f:facet name="header">
                                        <h:outputLabel value="Day Type"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.staffShift.dayType}" ></p:outputLabel>
                                </p:column>

                                <p:column headerText="Additionl OT Before Shift">
                                    <f:facet name="header">
                                        <h:outputLabel value="Additionl OT Before Shift"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.staffShift.extraTimeFromStartRecordVarified/ 60}" >
                                        <f:convertNumber pattern="0"/>
                                    </p:outputLabel>
                                </p:column>

                                <p:column headerText="Additional OT After Shift">
                                    <f:facet name="header">
                                        <h:outputLabel value="Additional OT After Shift"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.staffShift.extraTimeFromEndRecordVarified / 60}" >
                                        <f:convertNumber pattern="0"/>
                                    </p:outputLabel>
                                </p:column>

                                <p:column headerText="PH/DAY OFF">
                                    <f:facet name="header">
                                        <h:outputLabel value="PH/DAY OFF"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.staffShift.extraTimeCompleteRecordVarified / 60}" >
                                        <f:convertNumber pattern="0"/>
                                    </p:outputLabel>
                                </p:column>

                                <p:column headerText="In Time Varified">
                                    <f:facet name="header">
                                        <h:outputLabel value="In Time Varified"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.staffShift.startRecord.recordTimeStamp}" >
                                        <f:convertDateTime pattern="yyyy MM dd HH:mm:ss" />
                                    </p:outputLabel>
                                </p:column>

                                <p:column headerText="Out Time Varified">
                                    <f:facet name="header">
                                        <h:outputLabel value="Out Time Varified"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.staffShift.endRecord.recordTimeStamp}" >
                                        <f:convertDateTime pattern="yyyy MM dd HH:mm:ss" />
                                    </p:outputLabel>
                                </p:column>

                                <p:column headerText="Aproved By">
                                    <f:facet name="header">
                                        <h:outputLabel value="Aproved By"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.approvedStaff.person.nameWithTitle}" ></p:outputLabel>
                                </p:column>

                                <p:column headerText="Comment">
                                    <f:facet name="header">
                                        <h:outputLabel value="Comment"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.comments}" ></p:outputLabel>
                                </p:column>

                                <p:column headerText="ID">
                                    <f:facet name="header">
                                        <h:outputLabel value="ID"/>
                                    </f:facet>
                                    <p:outputLabel value="#{add.id}" ></p:outputLabel>
                                </p:column>
                                <p:column headerText="Retired">
                                    <f:facet name="header">
                                        <h:outputLabel value="Retired"/>
                                    </f:facet>
                                    <p:selectBooleanCheckbox value="#{add.retired}" />
                                </p:column>

                                <p:column>
                                    <p:commandButton ajax="false" value="Update"
                                                     action="#{staffAdditionalFormController.update(add)}"/>
                                </p:column>

                                <f:facet name="footer">
                                    <p:outputLabel value="Print By : #{sessionController.loggedUser.webUserPerson.name} - " />
                                    <p:outputLabel value="Print At : " />
                                    <p:outputLabel value="#{commonController.currentDateTime}" >
                                        <f:convertDateTime pattern="yyyy MMMM dd hh:mm:ss a " />
                                    </p:outputLabel>
                                </f:facet>
                            </p:dataTable>
                        </p:panel>
                    </p:panel>
                </h:panelGrid>
            </p:panel>
        </h:form>
    </ui:define> 

</ui:composition>
